// ok

export default {
  view_fp_users_tree: {
    _odoo_model: 'ir.ui.view',
    model: 'fp.users',
    type: 'tree',
    buttons: { create: true, edit: true, delete: true },
    fields: {
      company_id: { string: '公司' },
      name: { string: '名称' },
      user_id: { string: '用户' },
      login: { string: '账户' },
      payee_name: { string: '收款人' },
      checker_name: { string: '审核' },
      drawer_name: { string: '开票人' },
      taxmachine_id: { string: '税盘' },
      taxmachine_code: { string: '税盘编号' }
    }
  },

  view_fp_users_form: {
    _odoo_model: 'ir.ui.view',
    model: 'fp.users',
    type: 'form',
    buttons: { create: true, edit: true, delete: true },

    fields: {
      company_id: { string: '公司' },
      name: { string: '名称' },
      user_id: { string: '用户' },
      login: { string: '账户' },

      payee_name: { string: '收款人' },
      checker_name: { string: '审核' },
      drawer_name: { string: '开票人' },

      taxmachine_code: { string: '税盘编号' },

      taxmachine_id: {
        string: '税盘',
        domain: ({ record }) => {
          const { company_id } = record
          return [['company_id', '=', company_id[0]]]
        }
      }
    }
  },

  action_fp_users: {
    _odoo_model: 'ir.actions',
    name: '用户开票设置',
    type: 'ir.actions.act_window',
    res_model: 'fp.users',
    domain: [],
    context: {},
    views: {
      tree: 'view_fp_users_tree',
      form: 'view_fp_users_form'
    }
  }
}
